package dev.ideas.funkyj.tuple;

import dev.ideas.funkyj.sequence.Sequence;

import java.util.Iterator;

/**
 */
public abstract class Trio<T1, T2, T3> extends Tuple {
    public Trio() {}
    public abstract T1 first();
    public abstract T2 second();
    public abstract T3 third();

    public static <T1, T2, T3> Trio<T1, T2, T3> of(final T1 t1, final T2 t2, final T3 t3) {
        return new Trio<T1, T2, T3>() {
            @Override public T1 first() { return t1; }
            @Override public T2 second() { return t2; }
            @Override public T3 third() { return t3; }
        };
    }

    /*@Override*/ public Iterator iterator() {
        return Sequence.from(first(), second(), third()).iterator();
    }

    @Override public String toString() { return "(" + first() + "," + second() + "," + third() + ")"; }
}